﻿using JYH.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JYH.Model.API
{
    /// <summary>
    /// 响应结果
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class ResponseJson<T> where T : class, new()
    {
        public int Code { get; set; } = 200;
        public string Message { get; set; } = string.Empty;

        /// <summary>
        /// 分页索引，用于分页查询。
        /// </summary>
        [ResultColumn]
        public long PageIndex { get; set; } = 1;

        /// <summary>
        /// 分页大小，用于分页查询。
        /// </summary>
        [ResultColumn]
        public long PageSize { get; set; } = 10;

        /// <summary>
        ///  总记录数，用于分页查询。
        /// </summary>
        [ResultColumn]
        public long TotalCount { get; set; } = 0;

        /// <summary>
        ///  总页数，用于分页查询。
        /// </summary>
        [ResultColumn]
        public int TotalPage { get; set; } = 0;

        public List<T> Items { get; set; } = new List<T>();
    }

    /// <summary>
    /// 灯控列表
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class LigthList<T> where T : class, new()
    {
        /// <summary>
        /// 单据号
        /// </summary>
        public string OrderNO { get; set; } = string.Empty;


        /// <summary>
        /// 单据类型
        /// </summary>
        public string TradeType { get; set; }


        /// <summary>
        /// 需求明细ID
        /// </summary>
        public string TradeSourceID { get; set; }


        /// <summary>
        /// 操作用户
        /// </summary>
        public string UserName { get; set; } = string.Empty;

        /// <summary>
        /// 灯控颜色
        /// </summary>
        public int Color { get; set; }

        /// <summary>
        ///  灯控开关
        /// </summary>
        public bool LigthCheck { get; set; } = true;

        /// <summary>
        ///  灯控列表
        /// </summary>
        public List<T> Items { get; set; } = new List<T>();
    }

    public class ApiResponse
    {
        public bool Success { get; set; }
        public string Message { get; set; }
        public string ReportData { get; set; }

        public string Data { get; set; }
    }


    public class TreeGrid
    {
        public string total { get; set; }
        public List<TreeGridMenu> rows { get; set; }
    }

    public class TreeGridMenu
    {

        public int id { get; set; }
        public string state { get; set; }
        public string MenuID { get; set; }
        public string MenuNO { get; set; }
        public string MenuName { get; set; }
        public string MenuUrl { get; set; }
        public string ClassName { get; set; }
        public string NameSpace { get; set; }
        public string IconName { get; set; }
        public string RState { get; set; }
        public string UpMenuNO { get; set; }
        public string UpMenuName { get; set; }

        public string MenuType { get; set; }

        public string UpMenuID { get; set; }

        public string MenuTypeName 
        {
            get
            {
                switch (MenuType)
                {
                    default: return "Web Menu";
                    case "0":return "Web Menu";
                    case "1": return "PDA Menu";
                    case "2": return "Win Menu";
                    case "3": return "WebMenu";

                }
            }
        }

        public List<TreeMenu> children { get; set; }


    }


    public class TreeMenu
    {
        public string Opt { get; set; }
        public int id { get; set; }
        public string state { get; set; }
        public string MenuID { get; set; }
        public string MenuNO { get; set; }
        public string MenuName { get; set; }
        public string MenuUrl { get; set; }
        public string ClassName { get; set; }
        public string NameSpace { get; set; }
        public string IconName { get; set; }
        public string RState { get; set; }
        public string UpMenuNO { get; set; }
        public string UpMenuName { get; set; }

        public string MenuType { get; set; }

        public string UpMenuID { get; set; }

        public string MenuTypeName
        {
            get
            {
                switch (MenuType)
                {
                    default: return "Web Menu";
                    case "0": return "Web Menu";
                    case "1": return "PDA Menu";
                    case "2": return "Win Menu";
                    case "3": return "WebMenu";

                }
            }
        }




    }

}